package com.ght.springboot.schedule;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: haitao.gao
 * @create: 2019-03-12 07:55
 **/
@Configuration
public class QuartzJobConfig {


//    /**
//     * 方法调用明细工厂Bean
//     */
//    @Bean(name = "myFirstExerciseJobBean")
//    public MethodInvokingJobDetailFactoryBean myFirstExerciseJobBean(){
//
//        MethodInvokingJobDetailFactoryBean jobDetail = new MethodInvokingJobDetailFactoryBean();
//        jobDetail.setConcurrent(false); // 是否并发
//        jobDetail.setName("general-myFirstExerciseJob"); // 任务的名字
//        jobDetail.setGroup("general"); // 任务的分组
//        jobDetail.setTargetObject(TestSchedule.class); // 被执行的对象
//        jobDetail.setTargetMethod("myJobBusinessMethod"); // 被执行的方法
//        return jobDetail;
//
//    }
//
//    /**
//     * 表达式触发器工厂Bean
//     */
//    @Bean(name = "myFirstExerciseJobTrigger")
//    public CronTriggerFactoryBean myFirstExerciseJobTrigger(@Qualifier("myFirstExerciseJobBean") MethodInvokingJobDetailFactoryBean myFirstExerciseJobBean) {
//        CronTriggerFactoryBean tigger = new CronTriggerFactoryBean();
//        tigger.setJobDetail(myFirstExerciseJobBean.getObject());
//        tigger.setCronExpression("0/10 * * * * ?"); // 什么是否触发，Spring Scheduler Cron表达式
//        tigger.setName("general-myFirstExerciseJobTrigger");
//        return tigger;
//    }

}
